#include "master.h"

CMaster::CMaster(void)
{
	currentMode = MODE_SLEEP;
}

CMaster::~CMaster(void)
{
}

void CMaster::parseMessage(Message& msg, vector<Message>& retMsg)
{
	Message m;
	switch(msg.MsgCode)
	{
	case MSG_QUEUE_EMPTY:
			switch(currentMode)
			{
			case MODE_SLEEP:
					currentMode = MODE_UPDATE;
					m.Set("Master", "All", MSG_UPDATE);
					retMsg.push_back(m);
				break;
			case MODE_UPDATE:
					currentMode = MODE_DRAW;
					m.Set("Master", "All", MSG_DRAW);
					retMsg.push_back(m);
				break;
			case MODE_DRAW:
					currentMode = MODE_SLEEP;
					m.Set("Master", "Timer", MSG_TIMER_WAIT);
					retMsg.push_back(m);
				break;
			}
			break;
/*
	case MSG_TIMER:
		currentMode = MODE_UPDATE;
		m.Set("Master", "All", MSG_UPDATE);
		retMsg.push_back(m);
		break;
*/
	}
}